package com.example.mvvmtemplate.application;

import android.app.Application;
import android.content.pm.ApplicationInfo;

import com.example.mvvmtemplate.utli.log.PrintLog;

public class BaseApplication extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
        PrintLog.isLog = isApkInDebug();
    }

    /**
     * 判断当前应用是否是debug状态
     */
    public boolean isApkInDebug() {
        try {
            ApplicationInfo info = getApplicationInfo();
            return (info.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
        } catch (Exception e) {
            return false;
        }
    }
}
